﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace HTtxtTask
{
    class Program
    {
        static void Main(string[] args)
        {
            string pathString = @"E:\с#\Codeplex\Inteducation\apetrenko\HTtxtTask\HTtask\HT.txt";
            string readAllTextFromFile = File.ReadAllText(pathString);
            char[] Symbols = { ',', '.', '(', ')', '\n', '\r' };
            foreach (var item in Symbols)
            {
                if (readAllTextFromFile.Contains(item))
                {
                    readAllTextFromFile = readAllTextFromFile.Replace(item, ' ');
                }
            }
            string[] numberOfWords = readAllTextFromFile.Split(' ');

            string LongestWord = "";
            int maxElementsInWord = Int32.MinValue;
            foreach (var word in numberOfWords)
            {
                if (maxElementsInWord < word.Length)
                {
                    maxElementsInWord = word.Length;
                    LongestWord = word;
                }
            }
            Console.WriteLine("The largest word is '{0}' with {1} characters", LongestWord, maxElementsInWord);

            int count = 0;
            foreach (var word in numberOfWords)
            {
                if (word == "")
                {
                    continue;
                }
                else
                    count++;
            }
            Console.WriteLine("There are {0} words", count);
        }
    }
}
